import javax.swing.*;
import java.awt.*;

class StatisticsFrame extends JFrame {
    private JTextArea statsArea;

    public StatisticsFrame() {
        setTitle("所有算法统计");
        setSize(400, 400);
        setLayout(new BorderLayout());

        statsArea = new JTextArea();
        statsArea.setEditable(false);
        JScrollPane scrollPane = new JScrollPane(statsArea);

        add(scrollPane, BorderLayout.CENTER);
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }

    public void updateStats(java.util.List<Statistics> statsList) {
        StringBuilder statsText = new StringBuilder();
        for (Statistics stat : statsList) {
            statsText.append(stat.toString()).append("\n");
        }
        statsArea.setText(statsText.toString());
    }
}
